

//
//  AViewController.m
//  框架
//
//  Created by MyMac on 15/9/23.
//  Copyright (c) 2015年 tongfang. All rights reserved.
//

#import "AViewController.h"
#import "ContentViewController.h"
@interface AViewController ()

@end

@implementation AViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"A";
    self.navigationController.navigationBar.barTintColor=[UIColor yellowColor];
    self.view.backgroundColor=[UIColor brownColor];
    UIBarButtonItem*rightItem=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(right)];
    self.navigationItem.rightBarButtonItem=rightItem;

    UIButton*btn=[[UIButton alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
    btn.backgroundColor=[UIColor blackColor];
    [btn addTarget:self action:@selector(right) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];

}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    

}
-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
   

}
-(void)right
{

    [UIApplication sharedApplication].keyWindow.rootViewController=[[UIViewController alloc]init];


}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    ContentViewController*vc=[[ContentViewController alloc]init];
    vc.view.backgroundColor=[UIColor greenColor];
    [self.navigationController pushViewController:vc animated:YES];
    NSLog(@"%@",vc.navigationController.viewControllers);
   
}
-(void)dealloc
{
    NSLog(@"%@",self);
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
